#define SIF_AUTO 0
#define SIF_RGB 1
#define SIF_RGBA 2
#define SIF_PALLETE 3
#define SIF_INTENSITY 4

class image_src
{
public:
	GLsizei width;
	GLsizei height;
	GLsizei depth;

	GLenum format;
	GLint internalFormat;
	GLuint id;
	GLuint type;	
	GLubyte *texels;
	GLuint bpp;	
	bool comp;
	GLuint numMipmaps;
	int bpc;

	void Draw();
	unsigned int GetWidth();
	unsigned int GetHeight();
	unsigned int GetDepth();
	unsigned int GetBPP();
	unsigned int ReadPixel(unsigned int x, unsigned int y);
	fvec2 ReadPixel16F(unsigned int x, unsigned int y);
	fvec4 ReadPixel32F(unsigned int x, unsigned int y);
	void WritePixel(unsigned int x, unsigned int y, unsigned int rbga);
	void WritePixel16F(unsigned int x, unsigned int y, fvec2 rgba);
	void WritePixel32F(unsigned int x, unsigned int y, fvec4 rgba);

	unsigned int ApplyFilter(std::string fname);
	void Save(const char *filename, int format);

	static image_src *Create(unsigned int Width,unsigned int Height,unsigned int bpp,unsigned int bpc);
};

image_src * LoadImageFile(const char* file);
void FreeImageFile(image_src * src);
image_src * CopyOf(const image_src* source);